//
//  LOLFirstSkillTableViewCell.m
//  LOLXXbox
//
//  Created by dllo on 16/2/27.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLFirstSkillTableViewCell.h"
#import <Masonry.h>
#import <UIImageView+WebCache.h>
@implementation LOLFirstSkillTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViews = [[UIImageView alloc] init];
        [self.contentView addSubview:_imageViews];
        
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_nameLabel];
        
        self.levelLabel = [[UILabel alloc] init];
        self.levelLabel.font = [UIFont systemFontOfSize:15];
        self.levelLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:self.levelLabel];
        
        self.cooldownLabel = [[UILabel alloc] init];
        self.cooldownLabel.font = [UIFont systemFontOfSize:15];
        self.cooldownLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:self.cooldownLabel];
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    [self.imageViews mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(15);
        make.left.equalTo(self.contentView).offset(15);
        make.bottom.equalTo(self.contentView).offset(-15);
        make.width.equalTo(@70);
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(15);
        make.left.equalTo(self.imageViews.mas_right).offset(15);
        make.height.equalTo(@25);
        make.right.equalTo(self.contentView).offset(-15);
    }];
    
    [self.levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.imageViews.mas_right).offset(15);
        make.height.equalTo(@15);
        make.right.equalTo(self.contentView).offset(-15);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(10);
        
    }];
    
    [self.cooldownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.imageViews.mas_right).offset(15);
        make.height.equalTo(@15);
        make.bottom.equalTo(self.contentView).offset(-15);
        make.right.equalTo(self.contentView).offset(-15);
    }];
}

- (void)setSkillModel:(LOLSkillsModel *)skillModel{
    _skillModel = skillModel;
    self.nameLabel.text = self.skillModel.name;
    [self.imageViews sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://img.lolbox.duowan.com/spells/png/%@.png", self.skillModel.myId]]];
    self.levelLabel.text = [NSString stringWithFormat:@"需要等级 %@",self.skillModel.level];
    self.cooldownLabel.text = [NSString stringWithFormat:@"冷却时间 %@",self.skillModel.cooldown];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
